﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using CS.model;

namespace chaoshiguanli
{
    public partial class BuyGoodsInfo : Form
    {
        public List<shangp> showDataList;
        public shangp SelectGoods;
        public BuyGoodsInfo(List<shangp> list)
        {
            InitializeComponent();
            this.showDataList = list;
        }

        private void BuyGoodsInfo_Load(object sender, EventArgs e)
        {
            dgvxx.AutoGenerateColumns = false;
            dgvxx.DataSource = showDataList;
        }

        private void dgvxx_KeyUp(object sender, KeyEventArgs e)
        {
            if(e.KeyCode==Keys.Enter)
            {
                if (dgvxx.SelectedRows.Count==1) 
                {
                    int index = dgvxx.SelectedRows[0].Index;
                    SelectGoods = showDataList[index - 1];
                    this.Close();
                }
            }
        }
    }
}
